package com.fjnu.controller;

import java.util.Map;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.fjnu.controller.common.BaseController;
/**
 * 接收springmvc拦截的异常
 * 解决某些难以捕获的异常
 * 并以json的形式发送给前端
 * @author 默默
 *
 */
@Controller
@RequestMapping(value="/ExceptionToJson")
public class ExceptionController extends BaseController{
	/**
	 * 转发用户无权限访问异常
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/unauthotized")
	public Map<String,Object> unAuthorized(){
		if(!init().get(STATUS).equals(SUCCESS))
			return getData2Result();
		putFail("您没有该访问权限");
		return getData2Result();
	}
}
